import request from '@/utils/request.js'

// 文件分享
 export const shareFileService = (data) => {
    return request.post('/share', data)
}

// 批量取消文件分享
 export const cancelShareService = (ids) => {
    return request.delete('/share/cancelShare', { data: ids })
}

// 获取分享文件列表
 export const shareListService = (data) => {
    return request.get('/share/list', { params: data })
}

// 获取分享文件信息
 export const getShareFileInfoService = (id) => {
    return request.get('/share/getShareFileInfo', { params: { id } })
}

// 获取提取码
 export const getDownloadCodeService = (id) => {
    return request.get('/share/getDownloadCode', { params: { id } })
}

// 下载分享文件
 export const downloadShareFileService = (dto) => {
    return request.get('/share/download', {
        params: dto,
        responseType: 'blob'
    })
}
// 获取文件列表
export const fileListService = (data) => {
    return request.get('/file/list', { params: data })
}

// 上传文件
export const uploadFile = (data) => {
    return request.post('/file/upload', data, {
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 获取图片
export const getImageService = (id) => {
    return request.get(`/file/getImage/${id}`, { responseType: 'blob' })
}



// 文件重命名
export const fileRenameService = (data) => {
    return request.patch('/file/rename', data)
}


// 删除文件
export const delFileService = (ids) => {
    return request.patch('/file/delFile', ids)
}

// 下载文件
export const downloadFileService = (id) => {
    return request.get(`/file/download/${id}`, { responseType: 'blob' })
}

// 获取回收站文件列表
export const recycleListService = (data) => {
    return request.get('/recycle/list', { params: data })
}

// 恢复回收站文件
export const restoreFileService = (ids) => {
    return request.post('/recycle/restore', ids )
}

// 彻底删除回收站文件
export const deleteRecycleFileService = (ids) => {
    return request.delete('/recycle/delFile', { data: ids })
}





